package org.yuci.exception;

public class ExceptionPuzzle {
    
    public void foo() throws Exception {
        throw new Exception("My fault");
    }
    
    public void fun() {
        try {
            foo();
        } catch (Exception e) {
            System.out.println("Exception: " + e.getMessage());
            return;
        } finally {
            // "Finally" will be printed in the case of exception.
            System.out.println("Finally");
        }
    }
    
    /**
     * Output will be:
     * 
     * Exception: My fault
     * Finally
     * Done
     * 
     * @param args
     */
    public static void main(String[] args) {
        ExceptionPuzzle testException = new ExceptionPuzzle();
        testException.fun();
        System.out.println("Done");
    }
}
